﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace QiHe
{
    public partial class Task_Unfinish : Form
    {
        DataSet TSKList;
        int tc;
        DataSet ts;
        public Task_Unfinish()
        {
            InitializeComponent();
           // this.dataGridView1.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
            GetData();
        }


        public void GetData()
        {





            DBS sop = new DBS();
            TSKList = sop.RPlist_UnFinish();
           
            DataSet ts = TSKList.Copy();
            ts.Tables[0].Columns.Add(" 报修时间 ");
            ts.Tables[0].Columns.Add(" 报修设备 ");
            ts.Tables[0].Columns.Add(" 审批意见 ");
            ts.Tables[0].Columns.Add(" 审批人 ");
            ts.Tables[0].Columns.Add(" 报修科室 ");
            ts.Tables[0].Columns.Add(" 报修人 ");
            ts.Tables[0].Columns.Add(" 维修进程 ");
            ts.Tables[0].Columns.Add(" 工程师 ");
            ts.Tables[0].Columns.Add(" 故障描述 ");




            for (int i = 0; i < TSKList.Tables[0].Rows.Count; i++)
            {



                ts.Tables[0].Rows[i][" 报修时间 "] = TSKList.Tables[0].Rows[i][4].ToString();
                ts.Tables[0].Rows[i][" 报修设备 "] = TSKList.Tables[0].Rows[i][13].ToString();
                ts.Tables[0].Rows[i][" 审批意见 "] = TSKList.Tables[0].Rows[i][14].ToString();
                ts.Tables[0].Rows[i][" 审批人 "] = TSKList.Tables[0].Rows[i][16].ToString();
                ts.Tables[0].Rows[i][" 报修科室 "] = TSKList.Tables[0].Rows[i][12].ToString().Trim();
                ts.Tables[0].Rows[i][" 报修人 "] = TSKList.Tables[0].Rows[i][8].ToString();
                ts.Tables[0].Rows[i][" 故障描述 "] = TSKList.Tables[0].Rows[i][3].ToString();
                ts.Tables[0].Rows[i][" 维修进程 "] = TSKList.Tables[0].Rows[i][5].ToString();
                ts.Tables[0].Rows[i][ " 工程师 "] = TSKList.Tables[0].Rows[i][11].ToString();
            }











            ts.AcceptChanges();
            dataGridView1.DataSource = ts.Tables[0];
            tc = ts.Tables[0].Rows.Count;



            for (int i = 0; i < this.dataGridView1.Columns.Count; i++)
            {
                this.dataGridView1.Columns[i].SortMode = DataGridViewColumnSortMode.NotSortable;
            }
        }

     

        private void button1_Click(object sender, EventArgs e)
        {
            MedEQ.Service1 sop = new MedEQ.Service1();


            MedEQ.MySoapHeader Header = new MedEQ.MySoapHeader();//web引用创建soap头对象(改成您自己的)
            //设置soap头变量
            Header.UserName = "lee";
            Header.PassWord = "cmu4hlee1008";
            sop.MySoapHeaderValue = Header;
            sop.DEL_Task_By_Flag(TSKList.Tables[0].Rows[dataGridView1.CurrentCell.RowIndex][1].ToString());
            GetData();

        }




       
    

        private void button2_Click(object sender, EventArgs e)
        {
           
        }

        private void button3_Click(object sender, EventArgs e)
        {
      
            
           
        
        
        }

        private void button2_Click_1(object sender, EventArgs e)
        {
            Task.CallTime = TSKList.Tables[0].Rows[dataGridView1.CurrentCell.RowIndex][4].ToString();
            Task.Dept = TSKList.Tables[0].Rows[dataGridView1.CurrentCell.RowIndex][12].ToString();
            Task.CallUser = TSKList.Tables[0].Rows[dataGridView1.CurrentCell.RowIndex][8].ToString();
            Task.Content = TSKList.Tables[0].Rows[dataGridView1.CurrentCell.RowIndex][3].ToString();
            Task.State = TSKList.Tables[0].Rows[dataGridView1.CurrentCell.RowIndex][5].ToString();
            Task.EGN = TSKList.Tables[0].Rows[dataGridView1.CurrentCell.RowIndex][11].ToString();
            Task.Flag = TSKList.Tables[0].Rows[dataGridView1.CurrentCell.RowIndex][1].ToString();
            Task.EQName = TSKList.Tables[0].Rows[dataGridView1.CurrentCell.RowIndex][13].ToString();
            Task.Approve = TSKList.Tables[0].Rows[dataGridView1.CurrentCell.RowIndex][14].ToString();
            Task.ApproveContent = TSKList.Tables[0].Rows[dataGridView1.CurrentCell.RowIndex][15].ToString();
            Task.ApproveUser = TSKList.Tables[0].Rows[dataGridView1.CurrentCell.RowIndex][16].ToString();
            Task.Budget = TSKList.Tables[0].Rows[dataGridView1.CurrentCell.RowIndex][18].ToString();
            Task.BudgetAbout = TSKList.Tables[0].Rows[dataGridView1.CurrentCell.RowIndex][19].ToString();
            Task.MarketPrice = TSKList.Tables[0].Rows[dataGridView1.CurrentCell.RowIndex][17].ToString();
            Task_Info_Admin ti = new Task_Info_Admin();
            ti.ShowDialog();
            this.Refresh();
        }

        private void button3_Click_1(object sender, EventArgs e)
        {
            Log_Item_List ll = new Log_Item_List(TSKList.Tables[0].Rows[dataGridView1.CurrentCell.RowIndex][1].ToString());
            ll.ShowDialog();
        }
    }
}
